package cn.wolfcode.trip.base.service;


import cn.wolfcode.trip.base.domain.Strategy;

import cn.wolfcode.trip.base.query.QueryObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;

import java.util.List;
import java.util.Map;


public interface IStrategyService {

    void saveOrUpdate(Strategy entity);

    PageInfo query(QueryObject qo);

    List<Map> listAll();

    List<Strategy> listAllByState(QueryObject qo);

    PageInfo queryStrategyByPlaceId(QueryObject qo);

    /**
     * 查询某个攻略点赞或者收藏的个数
     * @param strategyId 攻略id
     * @param state 转态
     * @return 返回总的个数
     */

    Map<String,Object> selectPraiseNums(Long strategyId,Integer state);

    /**
     * 保存点评和用户关系
     * @param userId 用户id
     * @param strategyId 攻略id
     * @param state 状态:收藏/点赞
     */
    void insertRelation(Long userId, Long strategyId, Integer state);

    /**
     * 查看某条记录是否存在
     * @param userId 用户id
     * @param strategyId 攻略id
     * @param state 状态:收藏/点赞
     * @return 返回一个Boolean值
     */
    Boolean selectRelation(Long userId, Long strategyId, Integer state);

    /**
     * 删除某条点赞或者收藏记录
     * @param strategyId 攻略id
     * @param userId 用户id
     * @param state 收藏/点赞状态
     */
    void deleteRelation(Long strategyId, Long userId, Integer state);

    PageInfo queryByKeyword(QueryObject qo);
}
